﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ToolUtil;

namespace zymain
{
    public partial class FrmUpFileds : Form
    {
        public List<string> fileds;
        public string rtxt;
        public FrmUpFileds()
        {
            InitializeComponent();
        }

        private void editFileds()
        {
            if (fileds.Count > 0)
            {
                int i = 0, w = 40, h = 25;
                foreach (string str in fileds)
                {
                    RadioButton r = new RadioButton();
                    r.Name = "filed" + i.ToString();
                    r.Text = str;
                    if (i == 0)
                        r.Checked = true;
                    r.Tag = "filed" + i.ToString();
                    r.TabIndex = i;
                    r.Size = new Size(StringUtil.CharWidth(str)+20, 24);
                    r.Location = new Point(w, h);
                    r.CheckedChanged += new System.EventHandler(this.c_check);
                    if (w > panel1.Width - 200)
                    {
                        w = 40;
                        h = 50;
                    }
                    else
                        w += r.Width;
                    this.panel1.Controls.Add(r);
                    i++;
                }
            }
        }
        private void c_check(object sender, EventArgs e)
        {
            RadioButton r = (RadioButton)sender;
            rtxt=r.Text.Trim();
        }

        private void fr_Shown(object sender, EventArgs e)
        {
            this.editFileds();
        }

        private void enterBtn_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            base.Close();
        }
    }
}
